const seq = require('sequelize');
const db = require('../config/database');
const Model = db.defineModel('xs_books', {
	bookno: { type: seq.STRING(20), allowNull: true, comment: '小说编号', unique: true },
	bookname: { type: seq.STRING(50), comment: '小说标题', unique: true },
	bookauthor: { type: seq.STRING(50), allowNull: true, comment: '小说作者' },
	bookstatus: { type: seq.INTEGER, comment: '小说状态' },
	booktype: { type: seq.STRING(60), comment: '小说类型' },
	bookimg: { type: seq.STRING(150), allowNull: true, comment: '小说封面' },
	booknotice: { type: seq.TEXT, allowNull: true, comment: '小说简介' },
	booksrc: { type: seq.STRING(255), comment: '小说文件路径' },
	capturehref: { type: seq.STRING(255), allowNull: true, comment: '小说采集连接' },
	sourcesite: { type: seq.STRING(255), allowNull: true, comment: '小说来源站点' },
	createtime: { type: seq.BIGINT(13), comment: '小说创建时间' },
	updatetime: { type: seq.BIGINT(13), comment: '小说更新时间' }
});
Model.beforeCreate(function(book, options) {
	delete book.bookhref;
	return false;
});
module.exports = Model;